﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

namespace Dimok.Web.UI {
	public class GridViewMB : GridViewEx{
		private Profiler profileLib;
		protected override void OnInit(EventArgs e) {
			base.OnInit(e);
			ProfileCommon profile = Lib.GetProperty(Page.Master==null?(Control)Page:(Control)Page.Master, "ProfileLocal") as ProfileCommon;
			profileLib = new Profiler(profile, Page, this);
			PageSizeChanged += new GridViewPageSizeChangedEventHandler(Do_PageSizeChanged);
			TableControl tc = NamingContainer as TableControl;
			if (false && !Page.IsPostBack && tc != null) tc.PageSize = profileLib.Grid.PageSize;
			else PageSize = profileLib.Grid.PageSize;
		}

		void Do_PageSizeChanged(object sender, GridViewPageSizeChangedEventArgs e) {
			profileLib.Grid.PageSize = e.NewPageSize;
			profileLib.Save();
		}
	}
}
